A Simple Minecraft Status Discord Bot

A containerized Discord bot built with .NET 8, featuring dynamic configuration and real-time server monitoring for home-lab environments.

Project Overview & Features

  • Real-Time Querying: Instant server status checks using the MineStat library.
  • Dynamic Setup: Configure IP, Port, and Notify Channels directly via Discord Slash Commands.
  • Persistent State: Custom JSON-based storage system ensures settings survive container restarts.
  • Environment Aware: Securely handles API tokens via .env and environment variable injection.

Skills & Technologies Applied

C# / .NET 8 Docker Discord.Net API JSON Persistence

Workflow & Tools

Git + GitHub Visual Studio Postman

System Integration

Discord Live View

Bot running in Discord

Live interaction showing the formatted status output in a server.

Docker Deployment

Bot running in Docker

The .NET 8 runtime environment containerized for consistent deployment.

Dynamic Configuration Interface


[SlashCommand("setup", "Configure Minecraft settings")]
public async Task SetupCommandAsync(
    string serverName, string ip, ushort port = 25565)
{
    await DeferAsync(ephemeral: true);
    // Persist settings to JSON via ConfigService
    _configService.UpdateConfig(serverName, ip, port);
    await FollowupAsync($"✅ **Settings Saved!** IP: `{ip}`");
}
                    

This method allows admins to update the bot's target server IP and Port on the fly. The updated settings are passed to a configuration service which serializes them to a local JSON file, ensuring the bot remembers its setup even after a container reboot.

Server Status Query


[SlashCommand("status", "Query current server state")]
public async Task StatusCommandAsync()
{
    await DeferAsync();
    var status = await _mcService.GetFullStatus(_jsonService.Config);
    
    if (status.IsOnline)
        await FollowupAsync($"✅ **Online!** Players: `{status.CurrentOverMaxPlayers}`");
    else
        await FollowupAsync("❌ **Offline.** Check settings with /setup.");
}
                    

This method triggers the core logic of the bot: it pulls the saved configuration, queries the Minecraft server via a dedicated service, and returns the current player count and status directly to the Discord channel for all users to see.